package com.suning.app.snpaasadmin.operation;

import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class FactoryBase {
	private static SqlSessionFactory sqlSessionFactoryfordevelop;
	private static SqlSessionFactory sqlSessionFactoryforoperat;

    private static Reader readerfordevelop; 
    private static Reader readerforoperat; 
    static{
        try{
            readerfordevelop    = Resources.getResourceAsReader("Configuration.xml");
            sqlSessionFactoryfordevelop = new SqlSessionFactoryBuilder().build(readerfordevelop);
            
            readerforoperat    = Resources.getResourceAsReader("operationcfg.xml");
            sqlSessionFactoryforoperat = new SqlSessionFactoryBuilder().build(readerforoperat);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static SqlSessionFactory getSession(){
        return sqlSessionFactoryfordevelop;
    }
    
    public static SqlSessionFactory getSessionForOperat(){
        return sqlSessionFactoryforoperat;
    }
}

